﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Main_Shop : System.Web.UI.UserControl
{
    EncriptManager em = new EncriptManager();
    ShopDao sd = new ShopDao();
    DataTable dt = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        dt = sd.getShop("4");
        if (dt != null && dt.Rows.Count > 0)
        {
            dlshop.DataSource = dt;
            dlshop.DataBind();
            for (int i = 0; i < dlshop.Items.Count; i++)
            {
                HyperLink hlshop = dlshop.Items[i].FindControl("hlshop") as HyperLink;
                Label labSname = dlshop.Items[i].FindControl("labSname") as Label;
                Label labStype = dlshop.Items[i].FindControl("labStype") as Label;
                Image imgbtnshop = dlshop.Items[i].FindControl("imgbtnshop") as Image;
                string sid = em.Encript(dt.Rows[i][0].ToString());
                labStype.Text = sd.getFieldName(dt.Rows[i][2].ToString());
                hlshop.NavigateUrl = "ShopInfo.aspx?sid=" + sid;
                if (labSname.Text.Length > 10)
                {
                    labSname.Text = labSname.Text.Substring(0, 10) + "...";
                }
            }
        }
    }
}
